package com.smz.service.impl;

import com.smz.dao.UserRoleDAO;
import com.smz.entity.UserRole;
import com.smz.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserRoleServiceImpl implements UserRoleService {

    @Autowired
    private UserRoleDAO userRoleDAO;


    @Override
    public String addUserRole(UserRole userRole) {
        UserRole userRole1 = userRoleDAO.selectUserRoleById(userRole);
        if (userRole1==null){
            userRoleDAO.insetUserRole(userRole);
        }
        return "ok";
    }

    @Override
    public String deleteUserRole(UserRole userRole) {
        UserRole userRole1 = userRoleDAO.selectUserRoleById(userRole);
        if (userRole1!=null){
            userRoleDAO.deleteUserRole(userRole);
        }
        return "ok";
    }
}
